package com.ruoyi.business.domain.vo.product;

import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.business.domain.product.TbProductSkus;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
@Data
@ExcelIgnoreUnannotated
@ApiModel(value = "TbProduct", description = "商品主表VO类")
public class TbProductVO {
    //TbProduct 转TbProductVO


    /**
     * 商品主键ID
     */
    @ApiModelProperty(value = "主键id")
    @ExcelProperty(value = "商品ID")
    @TableId(value = "id",type = IdType.ASSIGN_ID)
    private Long id;

    /**
     * SPU编码
     */
    @ApiModelProperty(value = "SPU编码（商品统一编码）", example = "SPU20250001", position = 2)
    @ExcelProperty(value = "SPU编码")
    private String spuCode;

    /**
     * 商品标题
     */
    @ApiModelProperty(value = "商品标题", example = "2025新款智能手表", required = true, position = 3)
    @ExcelProperty(value = "商品标题")
    private String title;

    /**
     * 商品副标题
     */
    @ApiModelProperty(value = "商品副标题（补充说明）", example = "长续航·心率监测·防水", position = 4)
    @ExcelProperty(value = "商品副标题")
    private String subtitle;

    /**
     * 分类ID
     */
    @ApiModelProperty(value = "商品所属分类ID", example = "50", position = 5)
    @ExcelProperty(value = "分类ID")
    private Long categoryId;
    /**
     * 分类
     */
    @ApiModelProperty(value = "商品所属分类", example = "50", position = 5)
    @ExcelProperty(value = "分类")
    private String categoryName;
    /**
     * 主图数组
     */
    @ApiModelProperty(value = "主图数组（JSON格式，存储图片URL）",
        example = "[\"https://example.com/img1.jpg\", \"https://example.com/img2.jpg\"]",
        dataType = "List<String>", position = 6)
    @ExcelProperty(value = "主图URL列表")
    @TableField(typeHandler = JacksonTypeHandler.class)
    private List<String> mainImages;

    /**
     * 详情图数组
     */
    @ApiModelProperty(value = "详情图数组（JSON格式，存储图片URL）",
        example = "[\n" +
            "    \"https://example.com/images/speaker/detail1.jpg\",\n" +
            "    \"https://example.com/images/speaker/detail2.jpg\",\n" +
            "    \"https://example.com/images/speaker/detail3.jpg\",\n" +
            "    \"https://example.com/images/speaker/detail4.jpg\"\n" +
            "  ]",
        dataType = "List<String>", position = 7)
    @TableField(typeHandler = JacksonTypeHandler.class)
    @ExcelProperty(value = "详情图URL列表")
    private List<String> detailImages;

    /**
     * 主图视频
     */
    @ApiModelProperty(value = "主图视频URL（JSON格式，单个视频）",
        example = "https://example.com/video.mp4",
        dataType = "String", position = 8)
    @ExcelProperty(value = "主图视频URL")
    private String videoUrl;

    /**
     * 是否推荐
     */
    @ApiModelProperty(value = "是否推荐（0-否，1-是）", example = "1", allowableValues = "0,1", position = 9)
    @ExcelProperty(value = "是否推荐")
    private Integer isRecommend;

    /**
     * 是否热销
     */
    @ApiModelProperty(value = "是否热销（0-否，1-是）", example = "0", allowableValues = "0,1", position = 10)
    @ExcelProperty(value = "是否热销")
    private Integer isHot;

    /**
     * 是否新品
     */
    @ApiModelProperty(value = "是否新品（0-否，1-是）", example = "1", allowableValues = "0,1", position = 11)
    @ExcelProperty(value = "是否新品")
    private Integer isNew;

    /**
     * 最低价
     */
    @ApiModelProperty(value = "商品最低价", example = "199.99", position = 12)
    @ExcelProperty(value = "最低价")
    private String minPrice;

    /**
     * 最高价
     */
    @ApiModelProperty(value = "商品最高价", example = "299.99", position = 13)
    @ExcelProperty(value = "最高价")
    private String maxPrice;

    /**
     * 总库存
     */
    @ApiModelProperty(value = "商品总库存数量", example = "1000", position = 14)
    @ExcelProperty(value = "总库存")
    private Long totalStock;

    /**
     * 总销量
     */
    @ApiModelProperty(value = "商品总销量（真实销量）", example = "500", position = 15)
    @ExcelProperty(value = "总销量")
    private Long saleCount;

    /**
     * 虚拟销量
     */
    @ApiModelProperty(value = "商品虚拟销量", example = "1000", position = 16)
    @ExcelProperty(value = "虚拟销量")
    private Long virtualSaleCount;

    /**
     * 状态
     */
    @ApiModelProperty(value = "商品状态（0-下架，1-上架，2-审核中）",
        example = "1",
        allowableValues = "0,1,2",
        notes = "0-下架；1-上架；2-审核中",
        position = 17)
    @ExcelProperty(value = "状态")
    private Integer status;

    /**
     * 排序值
     */
    @ApiModelProperty(value = "排序值（数字越大越靠前）", example = "99", position = 18)
    @ExcelProperty(value = "排序值")
    private Long sortOrder;

    /**
     * 产品参数
     */
    @ApiModelProperty(value = "产品参数（JSON格式，键值对）",
        example = "{\"品牌\":\"XXX\",\"尺寸\":\"45mm\",\"颜色\":\"黑色\"}",
        dataType = "Object",
        notes = "根据实际参数结构存储",
        position = 19)
    @ExcelProperty(value = "产品参数")
    private Object specifications;

    /**
     * 搜索关键词
     */
    @ApiModelProperty(value = "搜索关键词（逗号分隔）", example = "智能手表,运动,防水", position = 20)
    @ExcelProperty(value = "搜索关键词")
    private String searchKeywords;

    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT)
    @ApiModelProperty(value = "创建时间", example = "2025-10-29 10:00:00", readOnly = true, position = 21)
    @ExcelProperty(value = "创建时间")
    private Date createTime;

    /**
     * 更新时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @ApiModelProperty(value = "更新时间", example = "2025-10-29 15:30:00", readOnly = true, position = 22)
    @ExcelProperty(value = "更新时间")
    private Date updateTime;

    /**
     * 创建人
     */
    @TableField(fill = FieldFill.INSERT)
    @ApiModelProperty(value = "创建人", example = "admin", readOnly = true, position = 23)
    @ExcelProperty(value = "创建人")
    private String createBy;

    /**
     * 更新人
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @ApiModelProperty(value = "更新人", example = "editor", readOnly = true, position = 24)
    @ExcelProperty(value = "更新人")
    private String updateBy;

    /**
     * 删除状态
     */
    @ApiModelProperty(value = "商品状态（0-未删除，1-已删除）",
        example = "0",
        allowableValues = "0,1",
        notes = "0-未删除；1-已删除",
        position = 25)
    @ExcelProperty(value = "删除状态")
    private Integer isDelete;

    @ApiModelProperty(value = "商品sku")
    private List<TbProductSkus> skusList;

    @ApiModelProperty(value = "是否参与积分兑换  0-不参与，1-参与", example = "0", allowableValues = "0,1", position = 26)
    private Integer isPoints;
}
